package com.yb.xczx.cloud.auth.deserializer.module;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.yb.xczx.cloud.auth.bean.XczxSysUser;
import com.yb.xczx.cloud.auth.bean.XczxUserPassAuthenticationToken;
import com.yb.xczx.cloud.auth.deserializer.mixin.XczxSysUserMixin;
import com.yb.xczx.cloud.auth.deserializer.mixin.XczxUserPassAuthenticationTokenMixin;
import org.springframework.security.jackson2.SecurityJackson2Modules;

public class XczxOauth2Jackson2Module extends SimpleModule {

	public XczxOauth2Jackson2Module() {
		super(XczxOauth2Jackson2Module.class.getName(), new Version(1, 0, 0, null, null, null));
	}

	@Override
	public void setupModule(SetupContext context) {
		SecurityJackson2Modules.enableDefaultTyping(context.getOwner());
		context.setMixInAnnotations(XczxSysUser.class, XczxSysUserMixin.class);
		context.setMixInAnnotations(XczxUserPassAuthenticationToken.class, XczxUserPassAuthenticationTokenMixin.class);
	}

}